package com.meichis.yndms.vm;

import androidx.lifecycle.MutableLiveData;

import com.meichis.yndms.model.DataTable;
import com.meichis.yndms.model.VstAnalyse;
import com.meichis.yndms.repository.manager.VstAnalyseManager;

import java.util.ArrayList;
import java.util.List;

/**
 * @author xmy
 * @title
 * @remake
 * @create 2021-05-08 15:26
 */
public class VstAnalyseVM extends MyViewModel {
    private MutableLiveData<List<VstAnalyse>> vstAnalyseList;
    private List<DataTable> dataTableList;
    private MutableLiveData<DataTable> dataTable;


    public MutableLiveData<DataTable> getDataTable() {
        if (dataTable == null) {
            dataTable = new MutableLiveData<>();
            dataTable.setValue(getDataTableList().get(0));
        }
        return dataTable;
    }

    public List<DataTable> getDataTableList() {
        if (dataTableList == null) {
            dataTableList = new ArrayList<>();
            //时间维度：0今日 1昨日 2本周 3本月
            dataTableList.add(new DataTable(1, "昨天"));
            dataTableList.add(new DataTable(0, "今天"));
            dataTableList.add(new DataTable(2, "本周"));
            dataTableList.add(new DataTable(3, "本月"));
        }
        return dataTableList;
    }

    public MutableLiveData<List<VstAnalyse>> getVstAnalyseList() {
        if (vstAnalyseList == null) {
            vstAnalyseList = new MutableLiveData<>();
        }
        return vstAnalyseList;
    }


    public void GetYWBFFX() {
        VstAnalyseManager.getInstance().GetYWBFFX(getShowDialog(), getUserInfo().getValue().getOrgId(), getDataTable().getValue().getValue(), getVstAnalyseList());
    }

}
